<template>
    <div class="StarList">
        <ul>
            <h3>
                <a @click="check">收藏的歌单</a>
                <i class="fa fa-angle-down" :class="{active:n,'fa-rotate-270':!n}"></i>
            </h3>
            <div v-show="n" v-for="{id,name,item} in list" :key="item">
                <router-link replace :to="{name:'MusicList',params:{id:id}}">
                    <li><i class="fa fa-list-ul"/>{{name}}</li>
                </router-link>
            </div>
        </ul>
    </div>
</template>

<script>
import {
    userPlaylist
} from '@/library/api/api'
export default {
    name:'StarList',
    data() {
        return {
            list:{},
            n:true,
        }
    },
    methods:{
        check() {
            this.n = !this.n
        },
    },
    created() {
        this.check,
        userPlaylist({
            data:{
                uid:localStorage.uid,
                limit:1000
            }
        }).then(res=>{
            res.playlist.shift()
            // console.log(res.playlist);
            this.list = res.playlist.map(item=>{
                return item
            })
        })
    }
}
</script>

